﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZebraCoreLib.Framework
{

    //public enum DBType
    //{
    //    Int,
    //    String,
    //    Email,
    //    PK
    //}

    [AttributeUsage(AttributeTargets.Property)]
    public class ZebraFieldAttribute : Attribute
    {
        /// <summary>
        /// 字段允许输入最大的长度。
        /// </summary>
        public int MaxSize { get; set; }
        /// <summary>
        /// 字段允许输入最大的长度。
        /// </summary>
        public int MinSize { get; set; }
        /// <summary>
        /// 数据库对应的字段
        /// </summary>
        public string DataField{get;set;}
        ///// <summary>
        ///// 字段类型
        ///// </summary>
        //public DBType DBType { get; set; }
        /// <summary>
        /// 是否可以为空
        /// </summary>
        public bool IsRequired { get; set; }
        /// <summary>
        /// 字段对应的标题
        /// </summary>
        public string Title { get; set; }
        /// <summary>
        /// 输出到文本框时的水印效果文字
        /// </summary>
        public string WaterMark { get; set; }
        /// <summary>
        /// 更新数据的时候是否要验证合法性
        /// </summary>
        public bool UpdateCheck { get; set; }
        /// <summary>
        /// 校验的正则表达式
        /// </summary>
        public string ValidationRegExpress { get; set; }
        /// <summary>
        /// 当发生错误的时候，文字描述，可以用{0}格式化
        /// </summary>
        public string OnErrorDescription { get; set; }
        /// <summary>
        /// 提示信息
        /// </summary>
        public string ToolTip { get; set; }
        /// <summary>
        /// 是否是主键
        /// </summary>
        public bool IsPrimaryKey { get; set; }
        /// <summary>
        /// 是否自动编号，以时间为序号
        /// </summary>
        public bool IsAutoID { get; set; }
        /// <summary>
        /// 明细表对应的外键
        /// </summary>
        public string Foreignkey { get; set; }

        /// <summary>
        /// 是否用户级别的关键字
        /// </summary>
        public bool UserScopeKey { get; set; }

        /// <summary>
        /// 是否是Sucode
        /// </summary>
        public bool IsSucode { get; set; }

        /// <summary>
        /// 是否排序
        /// </summary>
        public bool SortOrder { get; set; }
        public bool SortByDesc { get; set; }

        /// <summary>
        /// 关联字段，按照主表字段=明细表字段格式设置
        /// </summary>
        public string Relationship { get; set; }

        public ZebraFieldAttribute()
        {
            
           
        }
 
    }
    [AttributeUsage(AttributeTargets.Class)]
    public class ZebraBizObjectAttribute : Attribute
    {
        public string TableName { get; set; }
        public bool IsCacheData { get; set; }

       
    }
    [AttributeUsage(AttributeTargets.Method)]
    public class ZebraServiceMethodAttribute : Attribute
    {
        public string ValueMember { get; set; }
        public string DisplayMember { get; set; }
     
    }

}
